package com.zhuojy.equity.mall.admin.web.controller;

import com.sun.org.apache.regexp.internal.RE;
import com.zhuojy.equity.mall.admin.common.entity.TFlow;
import com.zhuojy.equity.mall.admin.common.pojo.JsonResult;
import com.zhuojy.equity.mall.admin.service.TFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 资金流水
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("flow")
@Api(tags = "资金流水")
public class TFlowController {
    @Autowired
    private TFlowService tFlowService;
    /**
     * 资金流水条查分页
     */
    @ApiOperation(value = "资金流水条查分页", httpMethod = "POST", notes = "资金流水条查分页")
    @RequestMapping("findflowPagination")
    public JsonResult findflowPagination(@RequestBody TFlow tFlow, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
        return tFlowService.findflowPagination(tFlow,pageNum,pageSize);
    }
    /**
     * 资金流水导出
     */
    @ApiOperation(value = "资金流水导出", httpMethod = "POST", notes = "资金流水导出")
    @RequestMapping(value = "/export/excel",produces = MediaType.APPLICATION_JSON_VALUE)
    public boolean exportExcel(HttpServletResponse response){
        tFlowService.exportExcel(response);
        return true;
    }
    /**
     * 资金流水下拉列表框
     */
    @ApiOperation(value = "资金流水下拉列表框", httpMethod = "POST", notes = "资金流水下拉列表框")
    @RequestMapping("findoptions")
    public List<TFlow> findoptions(){
        return tFlowService.findoptions();
    }
}
